﻿using IdentityModel;
using IdentityServer4;
using IdentityServer4.Test;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text.Json;
using System.Threading.Tasks;

namespace Yuan.IdentityServer4
{
    public class TestUsers
    {
        public static List<TestUser> Users
        {
            get
            {
                var address = new
                {
                    street_address = "One Hacker Way",
                    locality = "Heidelberg",
                    postal_code = 69118,
                    country = "Germany"
                };

                return new List<TestUser>
                {
                    new TestUser
                    {
                        SubjectId = "1",
                        Username = "admin",
                        Password = "123456",
                        Claims =
                        {
                            new Claim(JwtClaimTypes.Name, "张泽瑞"),
                            new Claim(JwtClaimTypes.GivenName, "张"),
                            new Claim(JwtClaimTypes.FamilyName, "Smith"),
                            new Claim(JwtClaimTypes.Email, "919686677@qq.com"),
                            new Claim(JwtClaimTypes.EmailVerified, "true", ClaimValueTypes.Boolean),
                            new Claim(JwtClaimTypes.WebSite, "http://www.baidu.com"),
                            new Claim(JwtClaimTypes.Address, JsonSerializer.Serialize(address), IdentityServerConstants.ClaimValueTypes.Json),

                            new Claim(JwtClaimTypes.Role,"role_admin")  //添加角色
                        },

                    },
                    new TestUser
                    {
                        SubjectId = "2",
                        Username = "test",
                        Password = "123456",
                        Claims =
                        {   new Claim(JwtClaimTypes.Role,"role_test"),  //添加角色
                            new Claim(JwtClaimTypes.Name, "test")
                            //new Claim(JwtClaimTypes.GivenName, "王"),
                            //new Claim(JwtClaimTypes.FamilyName, "Test"),
                            //new Claim(JwtClaimTypes.Email, "919686677@qq.com"),
                            //new Claim(JwtClaimTypes.EmailVerified, "true", ClaimValueTypes.Boolean),
                            //new Claim(JwtClaimTypes.WebSite, "http://www.qq.com"),
                            //new Claim(JwtClaimTypes.Address, JsonSerializer.Serialize(address), IdentityServerConstants.ClaimValueTypes.Json),
                   
                        },

                    }
                };
            }
        }
    }
}
